--------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\emergency_analysis.log
  log type:  text
 opened on:  13 Jul 2024, 07:41:12

. 
. /*******************************************************************************
> emergency_analysis.do
> 
> This code incorporates emergency ride data in district- and firm-level data
> *******************************************************************************/
. 
. qui {

. 
. qui {

. coefplot, keep(*months_since*) vert baselevel ///
>         recast(connected) ciopt(recast(rcap)) ///
>         xti(Months Since Prior Authorization Implementation) ///
>         xlab(1 "-24" 7 "-18" 13 "-12" 19 "-6" 25 "0" ///
>                 31 "6" 37 "12" 43 "18" 49 "24") ///
>         xline(25, lcolor(gs8) lpattern(dash)) yline(0, lcolor(gs8)) ///
>         yti("Firm-Level Non-Emergency Rides (Logs)") ///
>         ylab(,angle(0)) ///
>         graphregion(color(white)) bgcolor(white)

. qui graph export ${outpath}Figure_A11a.pdf, as(pdf) replace // Figure A11a

. 
. qui keep if priorauth_date==1

. collapse (mean) prepostPA_share_rides postpostPA_share_rides, by(firmstate)

. 
. twoway (hist prepostPA_share_rides if prepostPA_share_rides>0, width(.0249999999) start(0) freq) ///
>         (hist postpostPA_share_rides if postpostPA_share_rides>0, fcolor(none) lcolor(black) width(.0249999999) start(0) freq), ///
>         yti(Firms) xti("Non-Emergency Share of Rides for Dialysis Patients") ///
>         graphregion(color(white)) bgcolor(white) ///
>         leg(order(1 "Pre-Prior Auth." 2 "Post-Prior Auth."))

. qui graph export "${outpath}Figure_7.pdf", as(pdf) replace // Figure 7

. 
. codebook firmstate if prepostPA_share_rides==1 // Referenced in Section 5.3, Paragraph 1

--------------------------------------------------------------------------------------------------------------------------------------------------------
firmstate                                                                                                                               group(NPI state)
--------------------------------------------------------------------------------------------------------------------------------------------------------

                  Type: Numeric (float)

                 Range: [47,34359]                    Units: 1
         Unique values: 93                        Missing .: 0/93

                  Mean:   16315
             Std. dev.: 9886.11

           Percentiles:     10%       25%       50%       75%       90%
                           3517      8020     15364     24698     29021

. codebook firmstate if postpostPA_share_rides==1 // Referenced in Section 5.3, Paragraph 1

--------------------------------------------------------------------------------------------------------------------------------------------------------
firmstate                                                                                                                               group(NPI state)
--------------------------------------------------------------------------------------------------------------------------------------------------------

                  Type: Numeric (float)

                 Range: [100,34360]                   Units: 1
         Unique values: 120                       Missing .: 0/120

                  Mean: 18240.5
             Std. dev.: 10143.5

           Percentiles:     10%       25%       50%       75%       90%
                           4072      9473     19013   27756.5   32241.5

. 
. qui {

. /*heatplot pre_share cat_pre cat_post, ///
>         discrete colors(Blues) val(f(%4.3f)) backfill(i) ///
>         cuts(0 .125 .25 .375 .5 .625 .75 .875 1) ///
>         keylabels(, inter) leg(subti("Share of" "Pre-Prior Auth." "Firms")) ///
>         xti(Post-Prior Auth. Non-Emergency Share) ///
>         yti(Pre-Prior Auth. Non-Emergency Share) aspectratio(1) ///
>         xlab(0 "Exit" 0.5 "0.0" 1.5 "0.2" 2.5 "0.4" 3.5 "0.6" 4.5 "0.8" 5.5 ///
>                 "1.0" 6 `" "Only" "Non-" "Emergency" "', labsize(small)) ///
>         ylab(0 `" "New" "Entrant" "' 0.5 "0.0" 1.5 "0.2" 2.5 "0.4" 3.5 "0.6" 4.5 "0.8" 5.5 ///
>                 "1.0" 6 `" "Only" "Non-" "Emergency" "', ///
>                 labsize(small) angle(0) nogrid) graphregion(color(white))
> qui graph export ${outpath}Figure_A20.pdf, replace // Figure A20*/
. 
. log close
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\emergency_analysis.log
  log type:  text
 closed on:  13 Jul 2024, 07:42:55
--------------------------------------------------------------------------------------------------------------------------------------------------------
